package com.zhl.emp_manage.service;

import com.zhl.emp_manage.entity.Dept;
import com.zhl.emp_manage.mapper.DeptMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class DeptService {

    @Autowired
    private DeptMapper deptMapper;

    //查询所有部门
    public List<Dept> getAllDept() {
        return deptMapper.getAllDept();
    }

    //根据id查询部门信息
    public Dept getByDeptNo(Integer id) {
        return deptMapper.getByDeptNo(id);
    }

    //新增部门
    public boolean addDept(Dept dept) {
        return deptMapper.addDept(dept);
    }

    //修改部门信息
    public boolean updateDept(Dept dept) {
        return deptMapper.updateDept(dept);
    }

    //根据id删除部门信息
    public boolean deleteDept(Integer id) {
        return deptMapper.deleteDept(id);
    }

    //模糊查询
    public List<Dept> getDeptLike(String name) {
        return deptMapper.getDeptLike(name);
    }
}
